package com.itxx.keyCase;

import java.util.HashMap;
/*
统计题目:dhasjhdjahsjkdahjkdhajkhcjkhjkahsjkdahdkwqhuwyeuiqey

统计任意一个英文字符串中单词出现的次数,统计一个英文字符串中字母出现的次数.

* */
public class FileTest {
    public static void main(String[] args) {
        String s = "dhasjhdjahsjkdahjkdhajkhcjkhjkahsjkdahdkwqhuwyeuiqey";
        HashMap<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (!map.containsKey(c)) {
                map.put(c, 1);
            } else {
                map.put(c, map.get(c).intValue() + 1);
            }
        }
        System.out.println(map);
    }
}
